﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<ScrumTime.Models.HelpModel>" %>


<script runat="server">
    private ScrumTime.Models.Help getHelp(int id) {
        ScrumTime.Models.Help resultado = null;

        ScrumTime.Models.ScrumTimeEntities _ScrumTimeEntities = new ScrumTime.Models.ScrumTimeEntities();

        var results = from t in _ScrumTimeEntities.Helps
                      where t.HelpId == id
                      select t;
        if (results.Count() > 0)
            resultado = results.First<ScrumTime.Models.Help>();        
        
        return resultado;
    }
    
        
    
</script>

<%
            ScrumTime.Models.Help help = getHelp( Model.HelpId);
%>

<table width="100%">
    <tr>
        <td colspan="2">
            <literal style="font-weight:bold"> 
                Story Name:
            </literal>
            &nbsp<%: help.UserStoryName %>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <literal style="font-weight:bold"> 
                Description Old:
            </literal>
             &nbsp<%: help.Description1 %>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <literal style="font-weight:bold"> 
                Description New:
            </literal>
            &nbsp<%: help.Description1 %>
        </td>
    </tr>
    <tr>
        <td style="font-weight:bold">
            Old Tasks
        </td >
        <td style="font-weight:bold">
            New Tasks
        </td>
    </tr>
    <% 
        int contador = 0;
        
        while (contador < help.OldHelpDatas.Count  || contador < help.NewHelpDatas.Count)
        {
    %>
    <tr>
        <td>
            <% if (contador < help.OldHelpDatas.Count )
               { 
            %>
                <%: help.OldHelpDatas.ElementAt(contador).Description %>
            <%           
               } 
            %>
            
        </td>
        <td>
            <% if (contador < help.NewHelpDatas.Count )
               {
                   String colorFuente = "black";

                   //bool mark =  help.NewHelpDatas.ElementAt(contador).mark;
                   if (help.NewHelpDatas.ElementAt(contador).mark)
                   {
                       colorFuente = "red";
                   }
            %>
              <span style="color:<%:colorFuente%>">
                <%: help.NewHelpDatas.ElementAt(contador).Description%>
              </span>                            
            <%           
               } 
            %>
        </td>
    </tr>
    <%
        contador++;
        } 
    %>
</table>